From: Sebastian Keller Date: Fri, 13 Mar 2026 00:27:29 +0000 (+0100) Subject: systemActions: Fix initial visibility of logout action X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~28^2~4^2^2~5 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=21ac51df14d10d99f0fe0db76a110bceaad1f98d;p=gnome-shell.git systemActions: Fix initial visibility of logout action When `_updateLogout()` is called on login, the AccountsService user might not have been loaded yet. This would have resulted in all values being null/false, including `local_account`. Since `!localAccount` is one of the cases where the action is available, this would have wrongly resulted in the item being shown when not intended to be shown. But only until something triggers another call of `_updateLogout()`, such as locking/unlocking the session. Related: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/9100 Part-of: (cherry picked from commit 6f5f3c1f18a3597df04f831d4a8e1cdba2c0ecea) --- diff --git a/js/misc/systemActions.js b/js/misc/systemActions.js index d0a934d23..4017fc2a0 100644 --- a/js/misc/systemActions.js +++ b/js/misc/systemActions.js @@ -173,6 +173,10 @@ const SystemActions = GObject.registerClass({ this._userManager.connect('user-removed', () => this._updateMultiUser()); + this._user = this._userManager.get_user(GLib.get_user_name()); + + this._user.connect('notify::is-loaded', () => this._updateLogout()); + this._lockdownSettings.connect(`changed::${DISABLE_USER_SWITCH_KEY}`, () => this._updateSwitchUser()); this._lockdownSettings.connect(`changed::${DISABLE_LOG_OUT_KEY}`, @@ -399,12 +403,9 @@ const SystemActions = GObject.registerClass({ } _updateLogout() { - let user = this._userManager.get_user(GLib.get_user_name()); - let allowLogout = !this._lockdownSettings.get_boolean(DISABLE_LOG_OUT_KEY); let alwaysShow = global.settings.get_boolean(ALWAYS_SHOW_LOG_OUT_KEY); - let systemAccount = user.system_account; - let localAccount = user.local_account; + let {systemAccount, localAccount} = this._user; let multiUser = this._userManager.has_multiple_users; let multiSession = Gdm.get_session_ids().length > 1; let shouldShowInMode = !Main.sessionMode.isLocked && !Main.sessionMode.isGreeter;